import 'package:flutter/material.dart';

class ContainerPage extends StatefulWidget {
  @override
  _ContainerPageState createState() => new _ContainerPageState();
}

class _ContainerPageState extends State<ContainerPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Container"),
      ),
      body: _buildListView(),
    );
  }

  Widget _buildListView() {
    return ListView.builder(
      itemBuilder: (context, index) {
        return _buildListViewItem(index);
      },
      itemCount: containers.length,
    );
  }

  Widget _buildListViewItem(index) {
    return Container(
      padding: EdgeInsets.all(10.0),
      alignment: Alignment.center,
      child: containers[index],
    );
  }
}

List<Widget> containers = <Widget>[
  Column(
    children: <Widget>[
      Text("Color"),
      Container(
        color: Colors.blue,
        child: Text("Gnerv"),
      ),
    ],
  ),
  Column(
    children: <Widget>[
      Text("Padding"),
      Container(
        color: Colors.cyanAccent,
        padding: EdgeInsets.all(10.0),
        child: Text("Gnerv"),
      ),
    ],
  ),
  Column(
    children: <Widget>[
      Text("Margin"),
      Container(
        color: Colors.blue,
        margin: EdgeInsets.all(10.0),
        child: Text("Gnerv"),
      ),
    ],
  ),
  Column(
    children: <Widget>[
      Text("Decoration border"),
      Container(
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(12),
          border: Border.all(
            color: Colors.cyanAccent,
            width: 2,
            style: BorderStyle.solid,
          ),
        ),
        child: Text("Gnerv"),
      ),
    ],
  ),
  Column(
    children: <Widget>[
      Text("Decoration shape border"),
      Container(
        decoration: BoxDecoration(
          color: Colors.blue,
          shape: BoxShape.rectangle,
          borderRadius: BorderRadius.all(Radius.circular(12)),
        ),
        child: Text("Gnerv"),
      ),
    ],
  ),
  Column(
    children: <Widget>[
      Text("Decoration image border"),
      Container(
        width: 100,
        height: 90,
        decoration: BoxDecoration(
          image: new DecorationImage(
            image: new AssetImage('assets/images/cat.jpeg'),
          ),
          color: Colors.blue,
          shape: BoxShape.rectangle,
          borderRadius: BorderRadius.all(Radius.circular(12)),
        ),
      ),
    ],
  ),
  Column(
    children: <Widget>[
      Text("Transform"),
      Container(
        child: Text("Gnerv"),
        transform: Matrix4.rotationZ(0.5),
      ),
    ],
  ),
  Column(
    children: <Widget>[
      Text("Alignment"),
      Container(
        alignment: Alignment.center,
        color: Colors.blue,
        child: Text("Gnerv"),
      ),
    ],
  ),
  Column(
    children: <Widget>[
      Text("Alignment"),
      Container(
        width: 100,
        height: 30,
        alignment: Alignment.center,
        color: Colors.blue,
        child: Text("Gnerv"),
      ),
    ],
  ),
];
